import chalk from 'chalk'
import moment from 'moment'

export default () => async (ctx,next) => {
    let startTime = moment()
    await next()
    let newTime = moment()
    let ms = newTime - startTime
    console.info(chalk.green(`[${moment(newTime).format('MM-DD h:mm:ss')}]==> 🌎  ${ms}`))
    ctx.set('X-Response-Time', `${ms}ms`)
}
